<%-- 
    Document   : manage_add
    Created on : Nov 5, 2011, 3:11:00 PM
    Author     : Yudi Retanto
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<jsp:include page="/header.jsp"></jsp:include>
<h1>
    Tambah Layanan Pengiriman Paket
</h1>
<script type="text/javascript">
    function changeCityFrom(){
        city = $('#sCityFrom').val();
        if(city != 0){
            $('#sPoolFrom').load('./shuttles?action=manage&get=pool&city='+city);
            $('#sCityFrom .defCity').remove();
        }        
    }
    function changeCityTo(){
        city = $('#sCityTo').val();
        if(city != 0){
            $('#sPoolTo').load('./shuttles?action=manage&get=pool&city='+city);
            $('#sCityto .defCity').remove();
        }        
    }
    function changePool(){
        $('.defPool').remove();
    }
</script>
<form action="./shippings?action=manage&mode=add" method="post" onsubmit="return submit();">
<table id="manageForm">
    <tr>
        <td style="width: 20%;">
            <label for="cityFrom">Kota Keberangkatan :</label>
        </td>
        <td>
            <select id="sCityFrom" name="cityFrom" onchange="changeCityFrom();">
                <option class="defCity" value="0" selected="selected">Pilih Kota Keberangkatan</option>
                <c:forEach items="${cities}" var="city">
                    <option value="${city.getId()}">${city.getName()}</option>
                </c:forEach>
            </select>
        </td>
    </tr>
    <tr>
        <td>
            <label for="poolFrom">Pool Keberangkatan :</label>
        </td>
        <td>
            <select id="sPoolFrom" name="poolFrom" onchange="changePool()">
            </select>
        </td>
    </tr>
    <tr>
        <td style="width: 20%;">
            <label for="cityTo">Kota Tujuan :</label>
        </td>
        <td>
            <select id="sCityTo" name="cityTo" onchange="changeCityTo();">
                <option class="defCity" value="0" selected="selected">Pilih Kota Keberangkatan</option>
                <c:forEach items="${cities}" var="city">
                    <option value="${city.getId()}">${city.getName()}</option>
                </c:forEach>
            </select>
        </td>
    </tr>
    <tr>
        <td>
            <label for="poolTo">Pool Tujuan :</label>
        </td>
        <td>
            <select id="sPoolTo" name="poolTo" onchange="changePool()">
            </select>
        </td>
    </tr>
    <tr>
        <td>
            <label for="qos">Jenis Layanan :</label>
        </td>
        <td>
            <select name="qos">
                <c:forEach items="${qos}" var="q">
                    <option value="${q.getId()}">${q.getName()}</option>
                </c:forEach>
            </select>
        </td>
    </tr>
    <tr>
        <td>
            <label for="cost">Harga (/Kg) :</label>
        </td>
        <td>
            <input type="text" name="cost" />
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <input type="submit" value="Submit" />
        </td>
    </tr>
</table>
</form>
<jsp:include page="/footer.jsp"></jsp:include>
